package com.tigase.serviceImpl;/**
 * Created by tianfeng on 2017/7/27.
 */

import com.tigase.bean.TigaseFile;
import com.tigase.service.FileService;
import com.tigase.utils.UUIDUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author tianfeng
 * @create 2017-07-27 9:00
 **/
@Service
public class FileServiceImpl implements FileService{
    @Autowired
    private JdbcTemplate JdbcTemplate;
    @Override
    public int insertFile(TigaseFile file) {
        String sql="INSERT  into t_file (id,send_from,send_to,file_name,file_type,file_size,path,time) VALUES  (?,?,?,?,?,?,?,?) ";
        String uuid= UUIDUtils.getUUID();
        int a = JdbcTemplate.update(sql,uuid,file.getSendFrom(),file.getSendTo(),file.getFileName(),file.getFileType(),file.getFileSize(),file.getPath(),new Date());
        return a;
    }

    @Override
    public List<TigaseFile> getFile(String from, String to, String time) {
        return null;
    }
}
